//
//  SafeClauseViewController.m
//  TTAddressBook
//
//  Created by WangJuan on 12-1-9.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "SafeClauseViewController.h"
#import "imagePath.h"
#import "SettingConstants.h"

@implementation SafeClauseViewController
@synthesize navigationBarByIb;
@synthesize backButton;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    
    if (self) 
    {
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
   // backgroundView.image = [UIImage imageNamed:kRegBackGroundPng];
    [self.view addSubview:backgroundView];
    [self.view sendSubviewToBack:backgroundView];
    [backgroundView release];

    if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 5.0)
    {
        [navigationBarByIb setBackgroundImage:[UIImage imageNamed:UIContacts_contacts_navigationBar] forBarMetrics:0];
        [backButton setBackgroundImage:[UIImage imageNamed:kNavigationBarButtonPng] forState:UIControlStateNormal 
            barMetrics:0];
        [backButton setBackgroundImage:[UIImage imageNamed:kNavigationBarButtonOnPng] forState:UIControlStateSelected barMetrics:0];
    }
    else
    {
        navigationBarByIb.tintColor = [UIColor colorWithRed:0.0/255 green:130.0/255 blue:180.0/255 alpha:0.8];
    }
}

- (void)viewDidUnload
{
    [self setNavigationBarByIb:nil];
    [self setBackButton:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc 
{
    [navigationBarByIb release];
    [backButton release];
    [super dealloc];
}

- (IBAction)backButtonClick:(id)sender 
{
    [self dismissModalViewControllerAnimated:YES];
}

@end
